package com.uenpay.im.ui.old.activity.funds;

import com.uenpay.im.configuration.APIConfiguration;
import com.uenpay.im.entities.HttpInvokeResult;
import com.uenpay.im.invokeitems.BaseHttpInvokeItem;

import org.json.JSONException;
import org.json.JSONObject;


/**
 * @author SL
 * @created 2016-3-22 下午6:56:47
 * @copyRight http://www.qiyunxin.com
 * @function 删除群经费支出
 */
public class DeleteFundsCostInvokeItem extends BaseHttpInvokeItem {

	public class DeleteFundsCostInvokeItemResult extends HttpInvokeResult {
	}

	public DeleteFundsCostInvokeItemResult getOutPut() {
		return (DeleteFundsCostInvokeItemResult) GetResultObject();
	}

	/**
	 * 删除群经费支出
	 * 
	 * @param id
	 * @param chatid
	 */
	public DeleteFundsCostInvokeItem(int id, String chatid) {
		// http://api.qiyunxin.com/Chat/SpecialChat/delChatFeeTurnover?id=&chatid=
		String url = APIConfiguration.getBaseUrl()
				+ "Chat/SpecialChat/delChatFeeTurnover?id=" + id + "&chatid="
				+ chatid + "&" + APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) {
		DeleteFundsCostInvokeItemResult result = new DeleteFundsCostInvokeItemResult();
		JSONObject json = null;
		try {
			json = new JSONObject(responseBody);
			result.status = json.optInt("status");
			result.msg = json.optString("msg");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return result;
	}

}
